package com.example.printscreen.printscreen;

import android.app.Application;
import android.content.Context;

import com.example.printscreen.printscreen.utils.Constant;
import com.example.printscreen.printscreen.utils.Utils;


/**
 * 初始化数据及服务
 *
 * @author: xiaoluo
 * @date: 2016-12-20 17:53
 */
public class BaseApplication extends Application {
    private static final String TAG = BaseApplication.class.getSimpleName();

    private static Context mAppContext;
    private static BaseApplication instance;

    public static BaseApplication getInstance() {
        if (instance == null) {
            instance = new BaseApplication();
        }
        return instance;
    }

    @Override
    public void onCreate() {
        super.onCreate();
        mAppContext = this.getApplicationContext();

        Utils.createDir(Constant.ALL_IMAGE_DIR);
        Utils.createDir(Constant.UPLOAD_IMAGE_DIR);
        Utils.createDir(Constant.HANDLE_IMAGE_DIR);
    }

    /**
     * 获取AppContext
     */
    public static Context getAppContext() {
        return mAppContext;
    }

}
